#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>

int global_val = 704;
int main(){
    //创建轻量级进程
    pid_t pid = vfork();
    if(pid == 0){
        //子进程
        global_val += 1118;
        printf("child pid:%d,ppid:%d,global_val:%d\n",getpid(),getppid(),global_val);
        exit(0);
    }
    //父进程
    sleep(3);
    printf("father pid:%d,ppid:%d,global_val:%d\n",getpid(),getppid(),global_val);
    return 0;
}